#!/bin/bash

KERNEL_VERSION=5.15.56

# get linux kernel code
wget -c https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${KERNEL_VERSION}.tar.gz
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev flex libelf-dev bison
tar xf linux-${KERNEL_VERSION}.tar.gz

# build
cd linux-${KERNEL_VERSION}
cp /boot/config-$(uname -r) .config
make defconfig
make

# install modules and kernel
sudo make modules_install
sudo make install

# update initramfs and grub
sudo update-initramfs -c -k ${KERNEL_VERSION}
sudo update-grub
